#ifndef BODY_H
#define BODY_H

#include "tracker.h"

namespace eqPc{

	

	class Body{
	public:


		Body(BodyType type);
		~Body() {}


		eq::Matrix4f& getTransformation() 
			{ return _matrix; }
		float getQuality()
			{ return _quality;}
		TrackingState getState()
			{ return _state; }
		
		virtual void update(const eq::Matrix4f& matrix, float quality);


	protected:
		BodyType _type;				//Body type (HEAD || FLYSTICK)
		eq::Matrix4f _matrix;		//Transformation Matrix
		float _quality;				//0 <= _quality <= 1, not tracking if -1
		TrackingState _state;		//Tracking State
	
	private:

	};
		
	class Head : public Body
	{
	public:
		Head();
	};

	class FlyStick : public Body
	{
	public:
		FlyStick();
		~FlyStick(){}
		void update(const eq::Matrix4f& matrix, float quality, int *buttons, float *joystick);
		ButtonState getButtonState(Button button)
			{ return _buttons[button]; }
		const eq::Matrix4f& getDeltaMatrix();			//returns transformation matrix relative to trigger matrix
		//const eq::Matrix4f& getWorldDeltaMatrix();	//returns world_trigger_matrix * deltaMatrix

	private:
		ButtonState _buttons[5];
		float _joyStickValue[2];


		eq::Matrix4f _triggerMatrix;		//Transformation matrix when Switch is triggered, ZERO elsewise

		ButtonState _oldButtons[5];

		void _handleButtonState(int*);
		
	};
}


#endif